package com.zh.work.service.platform.channel.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.zh.work.dao.platform.channel.QuickChannelMapper;
import com.zh.work.entity.channel.QuickChannelEntity;
import com.zh.work.service.platform.channel.QuickChannelService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * code is far away from bug with the animal protecting
 * ┏┓　　　┏┓
 * ┏┛┻━━━┛┻┓
 * ┃　　　　　　　┃
 * ┃　　　━　　　┃
 * ┃　┳┛　┗┳　┃
 * ┃　　　　　　　┃
 * ┃　　　┻　　　┃
 * ┃　　　　　　　┃
 * ┗━┓　　　┏━┛
 * 　　┃　　　┃神兽保佑
 * 　　┃　　　┃代码无BUG！
 * 　　┃　　　┗━━━┓
 * 　　┃　　　　　　　┣┓
 * 　　┃　　　　　　　┏┛
 * 　　┗┓┓┏━┳┓┏┛
 * 　　　┃┫┫　┃┫┫
 * 　　　┗┻┛　┗┻┛
 *
 * @Description: 快捷渠道设置业务逻辑实现层
 * @Author: Li.HuiNeng
 * @Create in: 2019/09/05
 * @Version: 1.0.1
 */
@Service
public class QuickChannelServiceImpl extends ServiceImpl<QuickChannelMapper, QuickChannelEntity> implements QuickChannelService {

    @Autowired
    private QuickChannelMapper QuickChannelMapper;


    @Override
    public IPage<QuickChannelEntity> selectQuickChannelPages(Page<QuickChannelEntity> page, QuickChannelEntity quickChannelEntity) {
        return this.QuickChannelMapper.selectPage(
                page,
                new QueryWrapper<QuickChannelEntity>().lambda()
                        .like(StringUtils.isNotEmpty(quickChannelEntity.getChannelCode()), QuickChannelEntity::getChannelCode, quickChannelEntity.getChannelCode())
                        .like(StringUtils.isNotEmpty(quickChannelEntity.getChannelName()), QuickChannelEntity::getChannelName, quickChannelEntity.getChannelName())
        );
    }

}
